package com.djl.zenithbite.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

// Spring Boot 示例
@Configuration
public class CorsConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("http://localhost:8082/","http://192.168.10.10:8082/","http://localhost:8081/","http://192.168.10.10:8081/","http://localhost:8080/","http://192.168.10.10:8080/")
                .allowedMethods("*")
                .allowedHeaders("*")
                .allowCredentials(true)  // ← 允许凭证
                .maxAge(3600);
    }
}